package GameLogic

import (
	"PBMessage"

	"github.com/golang/protobuf/proto"

	"git.oschina.net/yangdao/GameLib/Unit"
)

func lineMoverToPB(lineMover *Unit.LineMover, unit *Unit.Unit) *PBMessage.SC_UnitAddMover {
	pb := &PBMessage.SC_UnitAddMover{}
	pb.UnitId = proto.Int64(unit.GUID)
	pb.MoverType = &lineMover.Name
	pb.Time = proto.Int64(lineMover.StartTime)
	pb.Int320 = proto.Int32(int32(lineMover.MoverDir.X * 100))
	pb.Int321 = proto.Int32(int32(lineMover.MoverDir.Y * 100))
	pb.Int322 = proto.Int32(int32(lineMover.MoverDir.Z * 100))

	pb.Int323 = proto.Int32(int32(lineMover.MoveDistance))
	pb.Int324 = proto.Int32(int32(lineMover.Speed))

	pb.PosX = proto.Int32(int32(unit.Pos().X * 100.0))
	pb.PosZ = proto.Int32(int32(unit.Pos().Z * 100.0))
	pb.PosY = proto.Int32(int32(unit.Pos().Y * 100.0))
	return pb
}
